#pragma once
template<class iterator, class Ref, class Ptr>
struct ReverseIterator
{
	typedef ReverseIterator<iterator, Ref, Ptr> self;
	iterator _cur;
	ReverseIterator(iterator it)
		:_cur(it)
	{}
	self& operator++()
	{
		--_cur;
		return *this;
	}
	self operator++(int)
	{
		self tmp(*this);
		--_cur;
		return tmp;
	}
	self& operator--()
	{
		++_cur;
		return *this;
	}
	self operator--(int)
	{
		self tmp(*this);
		++_cur;
		return tmp;
	}
	bool operator!=(const self& s)
	{
		return _cur != s._cur;
	}
	bool operator==(const self& s)
	{
		return _cur == s._cur;
	}
	Ref operator*()
	{
		iterator tmp = _cur;
		--tmp;
		return *tmp;
	}
	Ptr operator->()
	{
		return &(operator*());
	}
};
